feat: add playground and refactor code structure#358
feat: add playground and refactor code structure#358jonaslagoni wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
❌ Deploy Preview for the-codegen-project failed.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c972979. Configure here.
| // For YAML, we'd need to import stringify from yaml | ||
| // For now, default to JSON | ||
| return JSON.stringify(config, null, 2); | ||
| } |
There was a problem hiding this comment.
serializeConfig silently returns JSON for YAML format
Medium Severity
serializeConfig accepts a format parameter of 'json' | 'yaml' but always returns JSON output regardless. When a caller passes 'yaml', they silently get JSON back instead. The function's contract promises YAML support but doesn't deliver it, which will produce unexpected output for any consumer relying on YAML serialization.
Reviewed by Cursor Bugbot for commit c972979. Configure here.
| typeof browserBundle.default?.Parser | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Debug logging left in production browser shim
Medium Severity
Multiple console.debug calls in the browser shim will fire every time the module loads in a browser environment, logging internal bundle structure details (Bundle keys:, Parser type:, default type:, default.Parser type:) to the user's console. This appears to be diagnostic code left from development.
Reviewed by Cursor Bugbot for commit c972979. Configure here.
| get size(): number { | ||
| return this.files.size; | ||
| } | ||
| } |
There was a problem hiding this comment.
BrowserOutput duplicates MemoryAdapter functionality entirely
Low Severity
BrowserOutput in src/browser/adapters/output.ts duplicates nearly all functionality of MemoryAdapter in src/codegen/output/memory.ts. Both use a Map<string, string> to store files in memory, both implement OutputAdapter, and both expose write, read, has, clear, getWrittenFiles, and getAllFiles. The browser index even exports both classes side by side.
Reviewed by Cursor Bugbot for commit c972979. Configure here.


Note
Medium Risk
Medium risk because it refactors the generation pipeline from writing files during generation to returning
GeneratedFile[]and moves filesystem writes into the CLI, which can affect output paths/deduplication and downstream integrations.Overview
Adds a browser build + API for in-browser codegen. Introduces
src/browserentrypoints (generate,parseConfig,BrowserOutput) plus anesbuildbrowser bundling setup with Node polyfills and targeted shims forfs,@asyncapi/parser/browser,swagger-parser, andjson-schema-ref-parser(including lodash-to-lodash-esredirection and aSlowBufferpatch).Refactors core generation to be I/O-free. Generators and
renderGraphnow returnGeneratedFile[](path+content) instead offilesWrittenpaths, with shared Modelina generation viagenerateModels()and new portable path helpers (joinPath,relativePath); the CLIgeneratecommand now writes results to disk viawriteGeneratedFiles()and updates verbose/JSON output accordingly.Tests and tooling updated. Adds comprehensive browser generation tests (AsyncAPI/OpenAPI/JSON Schema,
$refcases, dependency ordering) and updates snapshots/path handling; addsesbuildtooling and typecheck steps tolint.Reviewed by Cursor Bugbot for commit c972979. Bugbot is set up for automated code reviews on this repo. Configure here.